const Web3 = require('web3')

if (typeof web3 !== 'undefined') {
    web3 = new Web3(web3.currentProvider);
} else {
    // set the provider you want from Web3.providers
    web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));
}

var chapter = require('../build/contracts/Chapter.json')
var index = require('../build/contracts/StoryIndex.json')

var CRT_chapter = new web3.eth.Contract(chapter.abi, "0x65e68c12f67e3ebd588f44049a61906df59e8318")

var CRT_index = new web3.eth.Contract(index.abi, "0x1b280aE208A82c1B4497b82C2A458A309cB84a50")

// CRT_chapter.methods.text().call().then((receipt) => {
//     console.log(receipt)
// });

CRT_index.methods.list().call().then((receipt) => {
    console.log(typeof receipt)
});

